<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/5/21 0021
 * Time: 15:19
 */
namespace Api\Controller;

/**
 * Class LaunchController
 * @package Api\Controller
 */
class LaunchController extends BaseController
{
    //投放广告获取投放信息
    public function get()
    {
        //店铺id
        $store_id = I('store_id');
        if($store_id==''||empty($store_id))$this->error('参数有误');
        //获取分屏信息
        $store_list = M('ShopStoreScreen')->where(['sid'=>$store_id,'status'=>1])->select();
        $config['up_self_limit'] = M('config')->where(['name'=>'UP_SELF_LIMIT'])->getField('value');//定向曝光平台收取费用
        $config['up_shop_limit'] = M('config')->where(['name'=>'UP_SHOP_LIMIT'])->getField('value');//定向曝光商家收取金额
        $config['up_limit_day'] = M('config')->where(['name'=>'UP_LIMIT_DAY'])->getField('value');//定向曝光最低天数
        $config['put_money'] = M('config')->where(['name'=>'PUT_MONEY'])->getField('value');//定向曝光一天单价

        $config['in_limit_day'] = M('config')->where(['name'=>'IN_LIMIT_DAY'])->getField('value');//定向引流最低天数
        $config['in_shop_limit'] = M('config')->where(['name'=>'IN_SHOP_LIMIT'])->getField('value');//定向引流商家收取费用
        $config['in_self_limit'] = M('config')->where(['name'=>'IN_SELF_LIMIT'])->getField('value');//定向引流平台收取费用
        $config['in_user_limit'] = M('config')->where(['name'=>'IN_USER_LIMIT'])->getField('value');//定向引流用户收取红包金额
        $config['min_red_number'] = M('config')->where(['name'=>'MIN_RED_NUMBER'])->getField('value');//定向引流最少红包数量
        $config['min_red_money'] = M('config')->where(['name'=>'MIN_RED_MONEY'])->getField('value');//引流红包最少金额
        $data['list'] = $store_list;
        $data['config'] = $config;
        //获取定向引流模板
        $temlist=M('template')->where(array('ad_type'=>1))->select();
        foreach($temlist as $k=>$v){
            $up_tem[$k]['id']=$v['img'];
            $up_tem[$k]['img']=SITE_URL.get_cover($v['img'],'path');
        }
        //查询定向曝光的模板
        $temlists=M('template')->where(array('ad_type'=>2))->select();
        foreach($temlists as $k=>$v){
            $in_tem[$k]['id']=$v['img'];
            $in_tem[$k]['img']=SITE_URL.get_cover($v['img'],'path');
        }
        $data['up_tem']=$up_tem;
        $data['in_tem']= $in_tem;
        $this->success('执行成功',$data);
    }

}